Hi everyone, below shows a code written to use "apply" after creating "multiList"s:
void compareAttrNames (DBE dbe) {
DB name_comparator = create "Attribute Name Comparator"
DBE myList1, myList2, myList3
void tabSelected(DBE attributeTab) {
int tab_choice = get attributeTab
}
void attributeGet (DBE myButton1, myList1, myList2, myList3) {
string AttrSet
string attrHolder1 = get myList1
string attrHolder2 = get myList2
string attrHolder3 = get myList3
print attrHolder1 "\n" attrHolder2 "\n" attrHolder3 "\n"
if(!null attrHolder1) {
inactive(myList2)
inactive(myList3)
}
if(!null attrHolder2) {
inactive(myList1)
inactive(myList3)
}
if(!null attrHolder3) {
inactive(myList1)
inactive(myList2)
}
if(!null attrHolder1)
AttrSet = attrHolder1
if(!null attrHolder2)
AttrSet = attrHolder2
if(!null attrHolder3)
AttrSet = attrHolder3
}
string name1, name2
string attrHolder1 = "" , attrHolder2 = "", attrHolder3 = ""
int idx1, idx2, idx11 = 0, idx12 = 0, idx13 = 0
int if_detecter = 0
int if_detecter1 = 0
idx1 = get list1 // position in list
idx2 = get list2
name1 = get list1 // baseline name
name2 = get list2
// This part performs actions to fill "array"s for the multiList functions.
DBE attributeTab = tab(name_comparator,options,300, 200, tabSelected)
DBE myButton1 = apply(name_comparator, "Display Objects", attributeGet)
show name_comparator
}
SystemAdmin - Tue May 19 05:34:10 EDT 2009 |
Re: What is wrong with this "apply" function In addition to this you can not "get" values from multiList, you have to iterate through the selected values in list, please look at the "for value in list (selected items)" in DXL Help for multiList. |
Re: What is wrong with this "apply" function Don't nest, its hard to read. Yes, 'apply' functions must have exactly one parameter, a DB. Mine routinely have 'DB dbXX' parameter and never use dbXX. Yes, 'button' and 'set' callback functions must have exactly one parameter, a DBE. 'DBE dbeXX' ditto. I don't recall the awkward realities of 'list' DBEs but the other post is no doubt correct about that. IIRC you need to 'realize' the DBE and THEN populate the lists, but maybe that's another kind of DBE. If you want a function to fire when the user selects or de-selectes in the list, you can use the 'set' callback, perhaps: void listWasClicked(DBE dbeList){deal with the dbeList}; and later on "set(myList1, listWasClicked)". Nit-Picks: Please comment the closing brace as to which thing its closing; its hard to see that the brace after your 6 'if' statements is closing function attributeGet. I think your first 3 'if's are wrong since if more than one DBE has a value you'll end up inactivating all of them. Perhaps: if (null attrHolder1) inactive(myList1), repeated for the other two. I see in function attributeGet(), that you calculate variable AttrSet but its never used. >Louie |